<%= form_for :order, :url => populate_orders_url do |f| %>
<%= hook :inside_product_cart_form do %>

  <% if product_price(@product) %>
    <%= hook :product_price do %>
      <div class="price-enlarge-buy">
			<p class="prices">
        <span class="price selling"><%= product_price(@product) %></span>
      </p>
			</div>
    <% end %>
  <% end %>

  <% if @product.has_variants? %>
    <div id="product-variants">
      <ul>
        <%  has_checked = false
        @product.variants.active.each_with_index do |v,index|
          next if v.option_values.empty? || (!v.in_stock && !Spree::Config[:show_zero_stock_products])
          checked = !has_checked && (v.in_stock || Spree::Config[:allow_backorders])
          has_checked = true if checked %>
          <li>
            <label>
              <%= radio_button_tag "products[#{@product.id}]", v.id, checked, :disabled => !v.in_stock && !Spree::Config[:allow_backorders] %>
              <span class="variant-description">
                <%= variant_options v %>
              </span>
              <% if variant_price_diff v %>
                <span class="price diff"><%= variant_price_diff v %></span>
              <% end %>
            </label>
          </li>
        <% end%>
      </ul>
    </div>
  <% end%>
  <% if @product.has_stock? || Spree::Config[:allow_backorders] %>
		<div class="pcount">
			<span>Qty:</span><%= text_field_tag (@product.has_variants? ? :quantity : "variants[#{@product.master.id}]"),1, :class => "title txtbox", :size => 3 %>
		</div>
    <div class="addtocart">
					  <input type="submit" class="continue button primary" value="Add to cart" />
		</div>
  <% else %>
    <%= content_tag('strong', t('out_of_stock')) %>
  <% end %>

<% end %>
<% end %>

<% content_for :head do %>
  <%= javascript_include_tag 'product' %>
<% end %>
